//
//  HorizonLineView.m
//  TestDrawLine
//
//  Created by guang on 14/12/26.
//  Copyright (c) 2014年 fangchou. All rights reserved.
//

#import "HorizonLineView.h"

@interface HorizonLineView()

@property (assign, nonatomic) CGRect rect;

@end

@implementation HorizonLineView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // Initialization code
        self.backgroundColor = [UIColor clearColor];
        self.rect = frame;
    }
    return self;
}


- (void)drawRect:(CGRect)rect
{
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetLineWidth(context, 0.5f);
    
    CGContextSetShouldAntialias(context, NO);
    
    CGContextSetStrokeColorWithColor(context, [[UIColor colorWithRed:221.0f/255.0f green:221.0f/255.0f blue:221.0f/255.0f alpha:1.0f] CGColor]);
    
    CGContextMoveToPoint(context, 0.0f, 0.5f);
    
    CGContextAddLineToPoint(context, self.rect.origin.x+self.rect.size.width, 0.5f);
    
    CGContextStrokePath(context);
}

@end
